﻿var common = {
    getUrlParam: function (name) {
        // 取得url中?后面的字符
        var query = window.location.search.substring(1);
        // 把参数按&拆分成数组
        var param_arr = query.split("&");
        for (var i = 0; i < param_arr.length; i++) {
            var pair = param_arr[i].split("=");
            if (pair[0] == name) {
                return pair[1];
            }
        }
        return (false);
    },
    padDate : function (value) {
        return value < 10 ? '0' + value : value;
    },
    getLogDate: function () {
        var date = new Date();
        var year = date.getFullYear();
        var month = common.padDate(date.getMonth() + 1);
        var day = common.padDate(date.getDate());
        return year +  month + day+".htm";
    },
    showLog: function (type) {
        var url = "http://" + window.location.host;
        var logName = common.getLogDate();
        if (type=="0") {
            url += "/log/info/" + logName;
        } else {
            url += "/log/error/" + logName;
        }
        window.open(url);
    },
    showWpsApiDoc: function () {
        var url = "https://open-doc.wps.cn/%E9%87%91%E5%B1%B1%E6%96%87%E6%A1%A3%E5%9C%A8%E7%BA%BF%E7%BC%96%E8%BE%91/";
        window.open(url);
    }
   
}